#ifndef GDT_H
	#define GDT_H
	
	#define GDT_TABLE_SIZE	0x05 /*GDT size*/
	
	#define GDT_BASE 0 /*GDT base*/
	
	#define GDT_LIMIT 0xFFFFFFFF /*GDT limit*/
	
	#define GDT_GRAN 0xCF /*GDT granularity*/
	
	#define GDT_KERNEL_CS_ACCESS 0x9A /*kernel code segment flags*/
	
	#define GDT_KERNEL_DS_ACCESS 0x92 /*kernel data segment flags*/
	
	#define GDT_USER_CS_ACCESS 0xFA /*user code segment flags*/
	
	#define GDT_USER_DS_ACCESS 0xF2 /*user data segment flags*/
	
	#define KERNEL_CS	0x08	/* Position 1 on GDT */
	#define KERNEL_DS	0x10	/* Position 2 on GDT */
	
	/*GDT entry table.*/
	struct _gdt_entry_table_struct {
		unsigned short  limit_l; /*lower 16 bits of the limit.*/
		unsigned short  base_l; /*lower 16 bits of the base.*/
		unsigned char base_m; /*midle 8 bits of the base.*/
		unsigned char access_mode; /*access flags.*/
		unsigned char granularity; /*granularity.*/
		unsigned char base_h; /*higher 8 bits of the base.*/
	} __attribute__ ((packed));
	
	/**
	 * gdtr_t
	 *
	 * GDTR store GDT table size (limit) and the pointer to the table
	 */
	struct _gdt_gdtr {
		unsigned short table_limit;
		unsigned int gdt_ptr;
	} __attribute__ ((packed)) GDTR;
	
	typedef struct _gdt_entry_table_struct gdt_entry_t;
	
	void init_GDT(void);
	inline void load_gdt(void);
	
#endif /* GDT_H */
